package com.nyist.threadCase2;

import com.nyist.thread.NyistThreadUtils;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 1.
 *
 * @ClassName ThreadTest
 * @Description
 * @Author xiaoyang
 * @Date 2023/04/04/16:42
 */
@Slf4j
public class ThreadTest {

    private static final Integer coreThreadNumber = NyistThreadUtils.getCoreThreadNumber() * 2;

    // 创建多线程的几种方式
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(coreThreadNumber, coreThreadNumber, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
        Thread thread = new Thread();
        try {
            thread.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        log.info("=====>>>核心线程数为:{}",coreThreadNumber);
    }
}
